---
# tasklist for setting up the mirrorlist app components
# create mirrormanager user
- name: add mirrormanager user - uid 441
  user: name=mirrormanager uid=441 state=present home=/home/mirrormanager createhome=yes

- name: install supervisor and mirrormanager
  yum: pkg={{ item }} state=installed
  with_items:
  - supervisor
  - mirrormanager
  tags:
  - packages

# mirrormanager user ssh key(s)
- name: add authorized_keys for mirrormanager
  authorized_key: key="{{ item }}" user=mirrormanager state=present
  with_file:
  - mm-authorized_key

# install mirrorlist-server.conf apache config
- name: mirrorlist-server apache conf
  copy: src=mirrorlist-server.conf dest=/etc/httpd/conf.d/mirrorlist-server.conf
  notify:
  - restart apache
  tags:
  - config

# nuke mirrormanager.conf so that it doesn't start up
- name: kill /etc/httpd/conf.d/mirrrormanager.conf
  copy: 'content="#blanked on purpose" dest=/etc/httpd/conf.d/mirrormanager.conf'
  notify:
  - restart apache
  tags:
  - config

# selinux policy - mirrormanager - put in place - for the sockfile
# 

# setup and configure supervisord
- name: /etc/supervisord.conf
  copy: src=supervisord.conf dest=/etc/supervisord.conf mode=0644
  notify:
  - restart supervisord

- name: enable supervisord
  service: name=supervisord state=started enabled=yes

